//
//  ViewController.m
//  26_GCDTest
//
//  Created by 徐昊 on 16/8/18.
//  Copyright © 2016年 徐昊. All rights reserved.
//

#import "ViewController.h"

@interface ViewController ()
@property (weak, nonatomic) IBOutlet UIImageView *imageView;
@property (weak, nonatomic) IBOutlet UIImageView *imageViewT;

@end

@implementation ViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view, typically from a nib.
}
- (IBAction)click:(UIButton *)sender {
    
    dispatch_queue_t queue = dispatch_queue_create("xuhao", DISPATCH_QUEUE_CONCURRENT);
    dispatch_async(queue, ^{
        NSData *data = [NSData dataWithContentsOfURL:[NSURL URLWithString:@"http://pic36.nipic.com/20131128/11748057_141932278338_2.jpg"]];
        dispatch_async(dispatch_get_main_queue(), ^{
            
            
            _imageView.image = [UIImage imageWithData:data];
        });
    });
    dispatch_async(queue, ^{
        
        NSData *data  = [NSData dataWithContentsOfURL:[NSURL URLWithString:@"http://scimg.jb51.net/allimg/160716/105-160G61F250436.jpg"]];
        dispatch_async(dispatch_get_main_queue(), ^{
            
            
            _imageViewT.image = [UIImage imageWithData:data];
        });
    });
}


- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}


@end
